<template>
<div>
  <el-container>
    <el-header height="80%"  width="100%">
            <span style="float: right">欢迎您，{{userName}}&nbsp;&nbsp;&nbsp;<a href="#" @click.prevent="getOut">退出登录</a></span>
      <h2  style="width:100%;text-align: center;float: right" >欢迎来到金讯通快速配送管理系统</h2>
    </el-header>
    <el-container style="margin-top: 10px">
      <el-aside width="200px" height="90%">
        <el-col :span="12" style="width: 100%;height: 100%">
          <el-menu
              default-active="/"
              class="el-menu-vertical-demo"
              text-color="#fff"
              active-text-color="#ffd04b"
              style="background-color: rgb(238, 241, 246)"
              router>
            <el-menu-item index="/historicalOrders">
              <span  style="color: #2c3e50">历史订单管理</span>
            </el-menu-item>
            <el-menu-item index="/address">
              <span  style="color: #2c3e50">用户地址管理</span>
            </el-menu-item>
            <el-menu-item index="/customer">
              <span  style="color: #2c3e50">用户管理</span>
            </el-menu-item>
            <el-menu-item index="/yardman">
              <span  style="color: #2c3e50">调度员信息管理</span>
            </el-menu-item>
            <el-menu-item index="/shops">
              <span  style="color: #2c3e50">店铺管理</span>
            </el-menu-item>
            <el-menu-item index="/goodsType">
              <span  style="color: #2c3e50">商品类型管理</span>
            </el-menu-item>
            <el-menu-item index="/shopType">
              <span  style="color: #2c3e50">店铺类型管理</span>
            </el-menu-item>
            <el-menu-item index="/courier">
              <span  style="color: #2c3e50">配送员信息管理</span>
            </el-menu-item>
            <el-menu-item index="/district">
              <span  style="color: #2c3e50">配送地址管理</span>
            </el-menu-item>
          </el-menu>
        </el-col>
      </el-aside>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</div>
</template>

<script>
export default {
  name: "Index",
  data(){
    return{
      userName:'',
    }
  },
  methods:{
    getOut(){
      sessionStorage.clear()
      this.$router.push('/login')
    },
    init(){
      let user = JSON.parse(sessionStorage.getItem('user'));
      if(user.name){
        this.userName=user.name
      }else {
        this.userName=user.phone
      }

    }
  },
  created() {
    this.init()
  }
}
</script>

<style scoped>

</style>